/**
 * @Description: 错误码类型
 * @Author: meidusa
 * @Date: 2025-10-03 17:13:35
 */

export const errorCodeType = (code: string | number) => {
    let errMessage: string = "未知错误";

    switch (code) {
        case 400:
            errMessage = "错误的请求!";
            break;

        case 401:
            errMessage = "未授权,请重新登录!";
            break;

        case 403:
            errMessage = "拒绝访问!";
            break;

        case 404:
            errMessage = "网络请求错误,未找到该资源!";
            break;

        case 405:
            errMessage = "网络请求错误,请求方法未允许!";
            break;

        case 408:
            errMessage = "网络请求超时!";
            break;

        case 500:
            errMessage = "服务器错误,请联系管理员!";
            break;

        case 501:
            errMessage = "网络未实现!";
            break;

        case 502:
            errMessage = "网络错误!";
            break;

        case 503:
            errMessage = "服务不可用，服务器暂时过载或维护!";
            break;

        case 504:
            errMessage = "网络超时!";
            break;

        case 505:
            errMessage = "http版本不支持该请求!";
            break;

        default:
            errMessage = `其他连接错误 --${code}`;
    }

    return errMessage;
};